package com.itheima.date8;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/*
jdk8  时间日期格式化相关方法

 */
public class Demo05 {

    public static void main(String[] args) {

        LocalDateTime now = LocalDateTime.now();
        String s = now.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss"));
        System.out.println(s);


        String timeStr="2011/11/11 01:11:11";
        LocalDateTime datetime = LocalDateTime.parse(timeStr, DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"));
        System.out.println(datetime);

    }
}
